package com.gis.bigdata.spark.core.rdd.operator.transform

import org.apache.spark.rdd.RDD
import org.apache.spark.{SparkConf, SparkContext}

/**
 * @author LnnuUser
 * @create 2021-08-27-下午6:36
 */
object Spark05_RDD_Operator_Transform {

  def main(args: Array[String]): Unit = {

    val sparkConf: SparkConf = new SparkConf().setMaster("local[*]").setAppName("Operator")
    val sc: SparkContext = new SparkContext(sparkConf)


    // TODO 算子 --mapPartitions
    val rdd: RDD[Int] = sc.makeRDD(List(
      1, 2, 3, 4
    ), 2)

    //List => Int
    //Int => List

    val glomRDD: RDD[Array[Int]] = rdd.glom()

    glomRDD.collect().foreach(data => println(data.mkString(",")))

    sc.stop()

  }

}
